<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="java.util.List"%>
<%@page import="cn.company.bean.Culture"%>
<%@page import="cn.company.database.DBUtils"%>
<style type="text/css">
</style>
<style type="text/css">
	#index_page{float:right;display:block;height:16px;padding:1px 0;margin-right:15px;}
	#index_page *{float:left;display:inline;line-height:16px;border:1px solid #B6CFCD;text-align:center;padding:0;margin:0 2px;}
	#index_page strong{background:#009A91;color:#fff;width:16px;}
	#index_page span{color:#009a91;padding:3px 0 0 0;border:0;cursor:pointer;}
	#index_page a{width:16px;color:#009A91;text-decoration:none;}
	
</style>
<%
	String path = request.getContextPath();
	List<Culture> cultures2 = DBUtils.getCulturesByCustom("最新资讯");
%>
<div align="center">
<table width="200" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    <script language="javascript" type="text/javascript">
		var _t1 = 0; //打开页面时等待图片载入的时间，单位为秒，可以设置为0
		var _t2 = 5; //图片轮转的间隔时间
		var _tnum = <%= cultures2.size() %>; //焦点图个数
		var _tn = 1;//当前焦点
		var _tl =1;
		_tt1 = setTimeout('change_img()',_t1*1000);
		function change_img(){
			setFocus(_tn);
			_tt1 = setTimeout('change_img()',_t2*1000);
		}
		function setFocus(i){
			if(i>_tnum){_tn=1;i=1;}
			document.getElementById('focusPic'+_tl).style.display='none';
			document.getElementById('focusPic'+i).style.display='block';
			_tl=i;
			_tn=i;
			_tn++;
	
			var flag=false; 
			function DrawImage(ImgD){ 
				var image=new Image(); 
		 		image.src=ImgD.src; 
		 		if(image.width>0 && image.height>0){ 
		  			flag=true; 
			  		if(image.width/image.height>= 164/112){ 
			   			if(image.width>164){
						    ImgD.width=164; 
						    ImgD.height=(image.height*164)/image.width; 
					    }else{ 
						    ImgD.width=image.width;
						    ImgD.height=image.height; 
			   			} 
			   		ImgD.alt=image.width+"x"+image.height; 
			  		} 
				    else{ 
					    if(image.height>112){
						    ImgD.height=112; 
						    ImgD.width=(image.width*112)/image.height; 
					   }else{ 
						    ImgD.width=image.width;
						    ImgD.height=image.height; 
					   } 
			   		   ImgD.alt=image.width+"x"+image.height; 
			  		} 
				}
			}
	
		}
	</script>
<!--焦点图1开始 标题13字 说明30个字-->
<%
	for(int i = 0;i < cultures2.size();i++){
%>
	<div id="focusPic<%=i+1 %>" class="center" style="display : none;">
		<a href="<%=path %>/Company/culture/culture_detailed.jsp?id=<%=cultures2.get(i).getId() %>" class="i_photo_a">
		<img src="<%= path + "/" + cultures2.get(i).getImagepath() %>" alt="<%=cultures2.get(i).getTopic() %>"  width="164" height="112" onload="javascript:DrawImage(this);" /></a>
		<div id="index_page">
		<%
			for(int j = 0;j < cultures2.size();j++) {
				int k = j+1;
				if (j == i) {
		%>
			<strong><%= k %></strong>
		<%
				} else {
		%>
			<a href="javascript:setFocus(<%=k %>);"><%=k %></a>
		<%
				}
			}
		%>
		</div>
		<h1 title="<%=cultures2.get(i).getTopic()%>"><a href="<%=path %>/Company/culture/culture_detailed.jsp?id=<%=cultures2.get(i).getId() %>"><%=cultures2.get(i).getTopic()%></a></h1>
	</div>
	<%
		if( i == 6){
			break;
		}
	}
	%>
<!--焦点图1结束-->
	</td>
  </tr>
</table>
</div>
